<?php

/* 内容管理 */
namespace app\appapi\controller;
use cmf\controller\HomeBaseController;
use think\facade\Db;

class PageController extends HomebaseController{
	
	public function lists() {

		$page=Db::name('portal_post')
            ->where("id=4")
            ->find();

        if (empty($page)) {
            $this->assign('reason', lang('页面不存在'));
            return $this->fetch(':error');
        }
		$language=cmf_current_lang();
		if($language=='en'){
			$page['post_title']=$page['post_title_en'];
		}

        $this->assign('page', $page);


        return $this->fetch('detail');
	}
    
    public function detail() {        
        $id      = $this->request->param('id', 0, 'intval');
        $page=Db::name('portal_post')
            ->where("id={$id}")
            ->find();

        if (empty($page)) {
            $this->assign('reason', lang('页面不存在'));
            return $this->fetch(':error');
        }
		$language=cmf_current_lang();
		if($language=='en'){
			$page['post_title']=$page['post_title_en'];
		}

        $this->assign('page', $page);


        return $this->fetch();
	}	
	

}